package com.ruoyi.key.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.key.domain.KeyStudent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.key.mapper.TbKeyallocationMapper;
import com.ruoyi.key.domain.TbKeyallocation;
import com.ruoyi.key.service.ITbKeyallocationService;

/**
 * 线索分配Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-25
 */
@Service
public class TbKeyallocationServiceImpl implements ITbKeyallocationService 
{
    @Autowired
    private TbKeyallocationMapper tbKeyallocationMapper;

    /**
     * 查询线索分配
     * 
     * @param allocationId 线索分配主键
     * @return 线索分配
     */
    @Override
    public TbKeyallocation selectTbKeyallocationByAllocationId(Long allocationId)
    {
        return tbKeyallocationMapper.selectTbKeyallocationByAllocationId(allocationId);
    }

    /**
     * 查询线索分配列表
     * 
     * @param tbKeyallocation 线索分配
     * @return 线索分配
     */
    @Override
    public List<TbKeyallocation> selectTbKeyallocationList(TbKeyallocation tbKeyallocation)
    {
        return tbKeyallocationMapper.selectTbKeyallocationList(tbKeyallocation);
    }

    /**
     * 新增线索分配
     * 
     * @param tbKeyallocation 线索分配
     * @return 结果
     */
    @Override
    public int insertTbKeyallocation(TbKeyallocation tbKeyallocation)
    {
        tbKeyallocation.setCreateTime(DateUtils.getNowDate());
        return tbKeyallocationMapper.insertTbKeyallocation(tbKeyallocation);
    }

    /**
     * 修改线索分配
     * 
     * @param tbKeyallocation 线索分配
     * @return 结果
     */
    @Override
    public int updateTbKeyallocation(TbKeyallocation tbKeyallocation)
    {
        return tbKeyallocationMapper.updateTbKeyallocation(tbKeyallocation);
    }

    /**
     * 批量删除线索分配
     * 
     * @param allocationIds 需要删除的线索分配主键
     * @return 结果
     */
    @Override
    public int deleteTbKeyallocationByAllocationIds(Long[] allocationIds)
    {
        return tbKeyallocationMapper.deleteTbKeyallocationByAllocationIds(allocationIds);
    }

    /**
     * 删除线索分配信息
     * 
     * @param allocationId 线索分配主键
     * @return 结果
     */
    @Override
    public int deleteTbKeyallocationByAllocationId(Long allocationId)
    {
        return tbKeyallocationMapper.deleteTbKeyallocationByAllocationId(allocationId);
    }

    @Override
    public List<KeyStudent> selectKeyStudentList(KeyStudent tbKeyallocation) {
        System.out.println(tbKeyallocation.getState());
     return tbKeyallocationMapper.selectKeyStudentList(tbKeyallocation);
    }
}
